package com.cm.behavior.strategy.example;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author gcm
 * @date 2024/2/28 17:44
 */
@Component
public class OfficeStrategyContext {

    @Autowired
    private final Map<String, OfficeStrategy> officeTypeStrategyMap = new ConcurrentHashMap<>();

    public OfficeStrategy getStrategy(String flag) {
        return this.officeTypeStrategyMap.get(String.format("%sOfficeStrategy", flag));
    }
}
